import request from '@/utils/request'

export default{
    getTypeList(searchModel){
        return request({
          url: '/type/list',
          method: 'get',
          params: {
            typeName: searchModel.typeName,
            id: searchModel.id,
            pageNo: searchModel.pageNo,
            pageSize: searchModel.pageSize
          }
        });
      },
      // 新增
      addType(type){
        return request({
          url: '/type',
          method: 'post',
          data: type
        });
      },
      // 修改
      updateType(type){
        return request({
          url: '/type',
          method: 'put',
          data: type
        });
      },
      // 保存角色数据
      saveType(type){
        if(type.id == null || type.id == undefined){
          return this.addType(type);
        }
        return this.updateType(type);
      },
      // 根据id查询
      getTypeById(id){
        return request({
          url: `/type/${id}`,
          method: 'get'
        });
      },

      deleteTypeById(id) {
        return request({
          url: `/type/${id}`,
          method: 'delete'
        });
      }


}

